﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZLDC.Common.Estate;
using System.Data;

namespace ZLDC.Topo.BLL.Estate
{
    public class DayReportBLL
    {
        public static string p_dayReport_save(int id, string ReportDate, string content, string adviseandplan, int readflag, string title)
        {
            string outmsg = "";
            int newid = 0;
            int userId =_Convert.ToInt(_Utility.GetInfoBySession().m_sUserID);
            int deptId =_Convert.ToInt(_Utility.GetInfoBySession().m_sDeptID);
            string deptName = _Utility.GetInfoBySession().m_sDeptName;
            string userName = _Utility.GetInfoBySession().m_sUserName;
            
            using (_Database db = new _Database("estate"))
            {
                ZLDC.DAL.Estate.DayReportDAL.p_dayReport_save(id, ReportDate, deptId, deptName, userId, userName, content, adviseandplan, readflag, title, out outmsg, out newid, db);
            }

            return outmsg;
        }
                public static string p_dayReport_list_table(int page,int pagesize,string condition) 
        {
            DataTable dt = null;
            int total = 0;                       int pageall = 0;         
            using (_Database db = new _Database("estate"))
            {
                dt = ZLDC.DAL.Estate.DayReportDAL.p_dayReport_list_table(page, pagesize, condition,ref total,db);
            }

            pageall = _Utility.GetPageAll(pagesize, total);      
            _Json json = new _Json(dt);

            return "{page:{currentpage:'" + page + "',pagesize:'" + pagesize + "',total:'" + total + "',pageall:'" + pageall + "'},record:" + json.ToJson() + "}";

        }
                public static DataSet SelectDayReportListById(int id)
        {
          using(_Database db=new _Database ("estate"))
          {
              return ZLDC.DAL.Estate.DayReportDAL.SelectDayReportListById(id, db);
          }
        }
    }
}
